package ru.amse.baltijsky.javascheme.nodeshape;

import java.awt.*;

/**
 * Tools for the convenient creating of shapes. Used only inside the shapes hierarchy.
 */
class ShapeTools {
    private static final double CIRCLE_SIZE_SCALE = 0.65;

    /**
     * Returns radius for circle shapes without text basing on the size of the chosen font.
     *
     * @param g the graphics context in which radius is calculated
     * @return the radius for the circle shape
     */
    static int getCircleRadius(Graphics g) {
        return (int) (g.getFontMetrics().getHeight() * Math.sqrt(2) * CIRCLE_SIZE_SCALE + 0.5d);
    }
}
